<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: XBee Configuration - OSC</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>XBee Configuration - OSC<br>
<small>
[<a class="el" href="group___o_s_c.html">OSC</a>]</small>
</h1>Configure an XBee module connected to your Make Controller Kit via OSC.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
<h2><a class="anchor" name="devices">
Devices</a></h2>
There can only be one XBee board connected to the Make Controller Kit's serial port at a time, so there is not a device index in XBee Config OSC messages.<h2><a class="anchor" name="properties">
Properties</a></h2>
The XBee Config system has the following properties:<ul>
<li>write</li><li>get-message</li><li>packet-mode</li><li>samplerate</li><li>address</li><li>panid</li><li>channel</li><li>at-command</li><li>io</li><li>active</li></ul>
<p>
Reading values from the XBee Config system is a bit different than the other systems. Because we need to see any messages that arrive at the XBee module and not just the one we're requesting at a given moment, to get any message back you need to use the <b>get-message</b> property. Imagine the case where we want to ask the module its address, but another module is busy sending us sensor values. If we waited for the address message, we'd miss all the sensor values.<p>
So to read a value, first send the request then call <b>get-message</b> until you get the response you're looking for. If you have autosend turned on, it will get messages for you, so you just need to send the request - this is much easier.<p>
<dl class="user" compact><dt><b>Write</b></dt><dd>When you change any of the paramters of your XBee module, it will by default revert back to its previous settings when it gets powered down. The <b>write</b> property sets the current values (all of them) into memory. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>For example, to set the sample rate to 100 milliseconds, and save it permanently, send the messages <div class="fragment"><pre class="fragment">
  /xbeeconfig/samplerate 100
  /xbeeconfig/write 1 </pre></div></dd></dl>
<dl class="user" compact><dt><b>Get Message</b></dt><dd>The <b>get-message</b> property fetches the most recent message received by the XBee module. If you have autosend turned on, you don't need to use get-message and, in fact, it won't have any effect. To get a message from your XBee module, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/get-message</pre></div> and the board will send one back if there were any available.</dd></dl>
<dl class="user" compact><dt><b>Sample Rate</b></dt><dd>The <b>samplerate</b> property corresponds to how often the XBee module will sample its IO pins and send a message with those values. If it's set to 0, the module will not sample its IO pins. The maximum sample rate is 65535. When the sample rate is set very low, the XBee module cannot guarantee that it will be able to keep up with all the samples requested of it. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>To set the sample rate to once a second (every 1000 milliseconds), send the message <div class="fragment"><pre class="fragment">/xbeeconfig/samplerate 1000</pre></div> To read the sample rate, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/samplerate </pre></div></dd></dl>
<dl class="user" compact><dt><b>Address</b></dt><dd>The <b>address</b> property corresponds to the address of the XBee module. Valid ranges for the address are from 0 - 65535. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>To set the address to 1234, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/address 1234</pre></div> To read the address, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/address </pre></div></dd></dl>
<dl class="user" compact><dt><b>Channel</b></dt><dd>The <b>channel</b> property corresponds to the channel of the XBee module. Valid ranges for the address are from 11 - 26 for XBee modules and 12 - 23 for XBee Pro modules. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>To set the channel to 15, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/channel 15</pre></div> To read the channel, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/channel </pre></div></dd></dl>
<dl class="user" compact><dt><b>AT Command</b></dt><dd>The <b>at-command</b> property allows you to read/write AT commands to your XBee module via OSC. The most common commands are included - samplerate, channel, address, etc. but this is helpful if you need to send any of the other commands to your module. To write a command, specify the 2-letter command and then the value to set. To enable encryption, for example, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/at-command EE 1</pre></div> </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>To read a value back via an AT command, simply send the 2-letter command you'd like to get the value for. To read back the hardware version, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/at-command HV</pre></div> Check the XBee documentation for a complete list of commands the boards will respond to.</dd></dl>
<dl class="user" compact><dt><b>PAN ID</b></dt><dd>The <b>panid</b> property corresponds to the Personal Area Network ID of the XBee module. Valid ranges for the address are from 0 - 65535. The default value is 13106. </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>To set the PAN ID to 512, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/panid 512</pre></div> To read the PAN ID, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/panid </pre></div></dd></dl>
<dl class="user" compact><dt><b>Input/Output Pins</b></dt><dd>There are several <b>io</b> properties that allow you to configure each of the 9 IO pins on the XBee module. Pins can be set to one of 5 values:<ul>
<li><b>0</b> - disabled</li><li><b>2</b> - analogin</li><li><b>3</b> - digital in</li><li><b>4</b> - digital out high</li><li><b>5</b> - digital out low</li></ul>
</dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>There are 9 IO pins on the XBee module, numbered 0 - 8. Send messages to them by specifying <b>io</b> + their number. Pin 8 cannot be an analogin - it can only be a digital in or out. For example, to set IO 0 to analogin, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/io0 2</pre></div> To set IO 6 to a digital in, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/io6 3</pre></div> To read the configuration of pin 5, send the message <div class="fragment"><pre class="fragment">/xbeeconfig/io5 </pre></div></dd></dl>
<dl class="user" compact><dt><b>Active</b></dt><dd>The <b>active</b> property corresponds to the active state of the XBee system. If you're not seeing appropriate responses to your messages to the XBee system, check whether it's active by sending the message <div class="fragment"><pre class="fragment">/xbee/active </pre></div> </dd></dl>
<dl class="user" compact><dt><b></b></dt><dd>You can set the active flag by sending <div class="fragment"><pre class="fragment">/xbee/active 1 </pre></div> </dd></dl>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
